import paramiko
from scp import SCPClient

if __name__ == '__main__':
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect('10.251.171.6', port=25539, username='u200111629', password='123456')

    # stdin, stdout, stderr = ssh.exec_command("ls")
    # print(stdout.read())
    # stdin, stdout, stderr = ssh.exec_command("cd jupyterlab; ls; cd aigc_server;")
    # print(stdout.read())

    command = f"cd jupyterlab/aigc_server; conda activate sadtalker; python sadtalker_test.py"
    stdin, stdout, stderr = ssh.exec_command(command)
    output = stdout.read().decode("utf-8")
    error = stderr.read().decode("utf-8")
    print(output)

    with SCPClient(ssh.get_transport()) as scp_client:
        scp_client.get("/home/u200111629/jupyterlab/aigc_server/data/sadtalker/9b1a9817-88e2-4ad0-bf7c-cfc3fb2d6a86/art_17##video_20240227100450_speed_1.mp4", "./art_17##video_20240227100450_speed_1.mp4")


    ssh.close()